package cn.mldn.experiment.threadOfProducerAndConsumer;

/*
 * 定义生产者
 */
public class Producer implements Runnable
{
	private Message msg = null;

	public Producer(Message msg)
	{
		this.msg = msg;
	}

	@Override
	public void run()
	{
		for (int x = 0; x < 50; x++)
		{ // 生产50次数据
			if (x % 2 == 0)
			{
				this.msg.set("生产者1", "生产数据1"); // 设置属性
			} else
			{
				this.msg.set("生产者2", "生产数据2"); // 设置属性
			}
		}
	}
}